package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.base.PageResponse;
import com.zzyl.entity.Role;
import com.zzyl.entity.RoleResource;
import com.zzyl.vo.RoleVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface RoleMapper {

    Page<RoleVo> queryPage(String roleName);

    void insert(Role role);

    @Select("select distinct resource_no from sys_role_resource where role_id = #{roleId}")
    List<String> findCheckedResourcesByRoleId(Long roleId);

    @Delete("delete from sys_role_resource where role_id = #{roleId}")
    void deleteByRoleId(Long roleId);

    void updateRole(Role role);

    void batchInsert(@Param("list") List<RoleResource> roleResourcesList);

    List<Role> initRoles(Object o);

    List<RoleVo> findRoleVoListInUserId(@Param("userIds") List<Long> userIds);

}











